package com.szqhyxj.youxiangju.biz.partnerHome.shop.order;

import com.szqhyxj.youxiangju.biz.merchantHome.shop.OrderList;
import com.szqhyxj.youxiangju.sys.BaseResult;
import com.szqhyxj.youxiangju.sys.RetrofitFacade;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * XiaoPanYu
 * on 2018/11/20
 */
public class SubordinatePartnerOrderModel{

    public interface OrderService {

        @POST("orderPosInfo/childOrder")
        Observable<BaseResult<OrderList>> getChildOrder();

        @FormUrlEncoded
        @POST("orderPosInfo/confirmOut")
        Observable<BaseResult> confirmOut(@Field("orderNo") String orderNo
        ,@Field("devNo") String devNo
        ,@Field("distributionType") int distributionType
        ,@Field("trackingNumber") String trackingNumber);

        @FormUrlEncoded
        @POST("orderPosInfo/outPosList")
        Observable<BaseResult<OrderPosListInfo>> getOutPosList(@Field("orderNo") String orderNo);

    }

    //获取下级订单列表
    public static Observable<BaseResult<OrderList>> getOrderList () {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).getChildOrder();
    }

    //确定发货
    public static Observable<BaseResult> confirmOut (PartnerOrderOutEntity entity) {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).confirmOut(entity.getOrderNo(),entity.getDevNo(),entity.getDistributionType(),entity.getTrackingNumber());
    }

    //确定订单详情
    public static Observable<BaseResult<OrderPosListInfo>> getOutPosList (String orderNo) {
        return RetrofitFacade.Companion.getRetrofit().create(OrderService.class).getOutPosList(orderNo);
    }


    public static class PartnerOrderOutEntity{

        /**
         * orderNo : YXJ181101112108X900000
         * devNo : [YXJCS1230000000001,YXJCS1230000000002,YXJCS1230000000003,YXJCS1230000000004,YXJCS1230000000005]
         * distributionType : 1
         * trackingNumber :
         */

        private String orderNo;
        private String devNo;
        private int distributionType;
        private String trackingNumber;

        public String getOrderNo(){
            return orderNo;
        }

        public void setOrderNo(String orderNo){
            this.orderNo = orderNo;
        }

        public String getDevNo(){
            return devNo;
        }

        public void setDevNo(String devNo){
            this.devNo = devNo;
        }

        public int getDistributionType(){
            return distributionType;
        }

        public void setDistributionType(int distributionType){
            this.distributionType = distributionType;
        }

        public String getTrackingNumber(){
            return trackingNumber;
        }

        public void setTrackingNumber(String trackingNumber){
            this.trackingNumber = trackingNumber;
        }
    }
}
